<html>
  <head>
    <script>
      function checkForValidUrl(tabId, changeInfo, tab) {
        if (tab.url.indexOf('https://') > -1) {
          chrome.pageAction.show(tabId);
		  var slash = tab.url.substring(8).indexOf('/')+8;
		  localStorage.setItem(tab.url.substring(8,slash),tab.url);
        }
		else{
		  var slash = tab.url.substring(7).indexOf('/')+7;
		  if(localStorage.getItem(tab.url.substring(7,slash)))
		  {
			chrome.pageAction.show(tabId);
			chrome.tabs.update(tab.id,{url:'https://'+tab.url.substring(7)});
		  }
		}
	  };
      chrome.tabs.onUpdated.addListener(checkForValidUrl);
	 </script>
  </head>
</html>